import { creatChunk } from './unit'
onmessage = async(e) => {
    const { file,
        size,
        startIdx,
        endIdx } = e.data;
    const proms = []
    for (let i = startIdx; i < endIdx; i++) {
        proms.push(creatChunk(file, i, size))
    }
   const chunks =  await Promise.all(proms)
   postMessage(chunks)
}